TFLite, ONNX, CoreML, TensorRT Export |
您所在的位置:网站首页 › ubuntu v100 › TFLite, ONNX, CoreML, TensorRT Export |
TFLite, ONNX, CoreML, TensorRT Export
📚 This guide explains how to export a trained YOLOv5 🚀 model from PyTorch to ONNX and TorchScript formats. UPDATED 8 December 2022. Before You StartClone repo and install requirements.txt in a Python>=3.7.0 environment, including PyTorch>=1.7. Models and datasets download automatically from the latest YOLOv5 release. git clone https://github.com/ultralytics/yolov5 # clone cd yolov5 pip install -r requirements.txt # installFor TensorRT export example (requires GPU) see our Colab notebook appendix section. YOLOv5 inference is officially supported in 11 formats: 💡 ProTip: Export to ONNX or OpenVINO for up to 3x CPU speedup. See CPU Benchmarks. 💡 ProTip: Export to TensorRT for up to 5x GPU speedup. See GPU Benchmarks. Format export.py --include Model PyTorch - yolov5s.pt TorchScript torchscript yolov5s.torchscript ONNX onnx yolov5s.onnx OpenVINO openvino yolov5s_openvino_model/ TensorRT engine yolov5s.engine CoreML coreml yolov5s.mlmodel TensorFlow SavedModel saved_model yolov5s_saved_model/ TensorFlow GraphDef pb yolov5s.pb TensorFlow Lite tflite yolov5s.tflite TensorFlow Edge TPU edgetpu yolov5s_edgetpu.tflite TensorFlow.js tfjs yolov5s_web_model/ PaddlePaddle paddle yolov5s_paddle_model/ BenchmarksBenchmarks below run on a Colab Pro with the YOLOv5 tutorial notebook This command exports a pretrained YOLOv5s model to TorchScript and ONNX formats. yolov5s.pt is the 'small' model, the second-smallest model available. Other options are yolov5n.pt, yolov5m.pt, yolov5l.pt and yolov5x.pt, along with their P6 counterparts i.e. yolov5s6.pt or you own custom training checkpoint i.e. runs/exp/weights/best.pt. For details on all available models please see our README table. python export.py --weights yolov5s.pt --include torchscript onnx💡 ProTip: Add --half to export models at FP16 half precision for smaller file sizes Output: export: data=data/coco128.yaml, weights=['yolov5s.pt'], imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, train=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=12, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['torchscript', 'onnx'] YOLOv5 🚀 v6.2-104-ge3e5122 Python-3.7.13 torch-1.12.1+cu113 CPU Downloading https://github.com/ultralytics/yolov5/releases/download/v6.2/yolov5s.pt to yolov5s.pt... 100% 14.1M/14.1M [00:00 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |